using System;
using ManticLabs.Common;

namespace ManticLabs.Data
{
	[Serializable()]
	public class MLabsException:System.Exception
	{

		private int lNumber;
		private LogLevelType lLoggerLevel;

		public MLabsException(LogLevelType logLevel)
		{
			Logger.Log("No specific information", logLevel);
			Logger.Log("Stack Trace:\n" + Environment.NewLine + Environment.StackTrace, logLevel); 
			lLoggerLevel = logLevel;
		}

		public MLabsException(int number, LogLevelType logLevel)
		{
			Logger.Log("Error Number: " + number, logLevel);
			Logger.Log("Stack Trace:\n" + Environment.NewLine + Environment.StackTrace, logLevel); 
			lNumber = number;
			lLoggerLevel = logLevel;
		}

		public MLabsException(string message, LogLevelType logLevel):base(message)
		{
			Logger.Log("Error Message: " + message, logLevel);
			Logger.Log("Stack Trace:" + Environment.NewLine + Environment.StackTrace, logLevel); 
			lLoggerLevel = logLevel;
		}

		public MLabsException(int number, string message, LogLevelType logLevel):base(message)
		{
			Logger.Log("Error Number: " + number + " Error Message: " + message, logLevel);
			Logger.Log("Stack Trace:\n" + Environment.NewLine + Environment.StackTrace, logLevel); 
			lNumber = number;
			lLoggerLevel = logLevel;
		}

		public MLabsException(string message, Exception inner, LogLevelType logLevel):base(message, inner)
		{
			Logger.Log(" Error Message: " + message + "; " + inner.Message, logLevel);
			Logger.Log("Stack Trace:\n" + Environment.NewLine + Environment.StackTrace, logLevel); 
			lLoggerLevel = logLevel;
		}

		public MLabsException(int number, string message, Exception inner, LogLevelType logLevel):base(message, inner)
		{
			Logger.Log("Error Number: " + number + " Error Message: " + message + "; " + inner.Message, logLevel);
			Logger.Log("Stack Trace:\n" + Environment.NewLine + Environment.StackTrace, logLevel); 
			lNumber = number;
			lLoggerLevel = logLevel;
		}

		public int Number
		{
			get
			{
				return lNumber;
			}
		}

		public LogLevelType LoggerLevel
		{
			get
			{
				return lLoggerLevel;
			}
		}
	}
}